//
//  E7MenuLayer.h
//  E7_ENGINE
//
//  Created by cc on 12-3-2.
//  Copyright (c) 2012年 PalmGame. All rights reserved.
//

#ifndef E7_ENGINE_E7MenuLayer_h
#define E7_ENGINE_E7MenuLayer_h

#include "E7GameDefine.h"

#include "E7TouchSprite.h"

class  CE7MenuLayer : public CE7Layer
{
public:
    CE7MenuLayer() ;
    CE7MenuLayer(int flag) ;
    ~CE7MenuLayer() ;

    void ClickedNormalBattle() ;
    void ClickedCustomBattle() ;

public:
//    virtual void draw() ;
    virtual bool Loop() ;

	virtual void ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent);
	virtual void ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent);
	virtual void ccTouchesEnded(CCSet *pTouches, CCEvent *pEvent);
	virtual void ccTouchesCancelled(CCSet *pTouches, CCEvent *pEvent);

private:
    int            m_nFlag ;
    CE7Sprite*     m_pGameNameSprite ;
    CCSprite*      m_pGameNameStrSprite ;
    CCSprite*      m_pGameNameLightSprite ;
    CCMenu*        m_pButtons ;
    CCMenuItem*    m_pButtonNormalBattle ;
    CCMenuItem*    m_pButtonCustomBattle ;
    CCSprite*      m_pActiveCustomSprite ;

public:
    CE7AnimationGameName* m_pGameName ;
    CE7AnimationSprite*   m_pGameNameStr ;
    CE7AnimationSprite*   m_pGameNameLight ;
    CE7AnimationSprite*   m_pNormal ;
    CE7AnimationSprite*   m_pCustom ;

// custom layer. ========================= S
private:
    void InitCustomData() ;
    void ClickedSelectMap_0() ;
    void ClickedSelectMap_1() ;
    void ClickedSelectMap_2() ;
    void ClickedCustomGenerate() ;
    void ClickedCustomStartGame() ;
    void ClickedCustomAgain() ;
    void ClickedCustomClose() ;

private:
    int            m_nGameLayerTag ;

    CCLayer*       m_pCustomLayer ;
    int            m_nSelIndex ;
    CCPoint        m_posSelMap[3] ;

    CE7Sprite*     m_pSelMapBackSprite ;
    CE7Sprite*     m_pMapSizeSprite ;
    CE7Sprite*     m_pSelMapSprite ;
    CCMenu*        m_pDialogButtons ;
    CCMenuItem*    m_pButtonFrame[3] ;
    CCMenuItem*    m_pButtonGenerate ;
    CCMenuItem*    m_pButtonOK ;
    CCMenuItem*    m_pButtonAgain ;
    CCMenuItem*    m_pButtonClose ;
// custom layer. ========================= E

// normal layer. ========================= S
public:
    void StartNormalGame(int stage) ;
private:
    void InitNormalData() ;

    void ClickedNormalClose() ;
    void ClickedNormalLeft() ;
    void ClickedNormalRight() ;

    void InitStageSprite() ;
private:
    bool               m_bIsNormalAnimation ;
    CCLayer*           m_pNormalLayer ;
    CE7Sprite*         m_pBackNormalSprite ;
    CCMenu*            m_pDialogNormalButtons ;
    CCMenuItem*        m_pButtonNormalClose ;
    CCMenuItem*        m_pButtonNormalLeft ;
    CCMenuItem*        m_pButtonNormalRight ;

    int                m_nPageIndex ;
    CCSpriteBatchNode* m_pStageNumberSheet ;
    CE7TouchSprite*    m_pStageRoot[STAGE_COUNT] ;
    CCSprite*          m_pStageNormal[STAGE_COUNT] ;
    CCSprite*          m_pStageSelect[STAGE_COUNT] ;
    CCSprite*          m_pStageC[STAGE_COUNT] ;
    CCSprite*          m_pStageL[STAGE_COUNT] ;
    CCSprite*          m_pStageR[STAGE_COUNT] ;

// normal layer. ========================= E
};

#endif


















